<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <!-- 本地 -->
    <script src="../js/jquery-1.10.1.min.js"></script>
    <style>
        * {
            padding: 0;
            margin: 0;
        }

        li {
            list-style: none;
        }

        a {
            color: inherit;
            text-decoration: none;
        }

        .nav {
            width: 1140px;
            display: flex;
            margin: 0 auto;
        }

        .nav>li {
            width: -webkit-calc(100% / 6);
            text-align: center;
            line-height: 40px;
            border: 1px dashed #333;
            float: left;
            position: relative;
        }

        .nav>li.active {
            background-color: #6ff;
        }

        .nav .subNav {
            width: 100%;
            position: absolute;
            text-indent: 10px;
            display: none;
        }

        .nav .show {
            display: block;
        }

        .subNav li {
            border: 1px dashed #333;
        }




        .subNav li+li {
            border-top: 0;
        }
    </style>

</head>

<body>
    <ul class="nav">
        <li>
            <a href="javascript:;">link_01</a>
            <ul class="subNav">
                <li>sub_01</li>
                <li>sub_02</li>
                <li>sub_03</li>
                <li>sub_04</li>
            </ul>
        </li>
        <li>
            <a href="javascript:;">link_02</a>
            <ul class="subNav">
                <li>sub_01</li>
                <li>sub_02</li>
                <li>sub_03</li>
                <li>sub_04</li>
            </ul>
        </li>
        <li>
            <a href="javascript:;">link_03</a>
            <ul class="subNav">
                <li>sub_01</li>
                <li>sub_02</li>
                <li>sub_03</li>
                <li>sub_04</li>
            </ul>
        </li>
        <li>
            <a href="javascript:;">link_04</a>
            <ul class="subNav">
                <li>sub_01</li>
                <li>sub_02</li>
                <li>sub_03</li>
                <li>sub_04</li>
            </ul>
        </li>
        <li>
            <a href="javascript:;">link_05</a>
            <ul class="subNav">
                <li>sub_01</li>
                <li>sub_02</li>
                <li>sub_03</li>
                <li>sub_04</li>
            </ul>
        </li>
        <li>
            <a href="javascript:;">link_06</a>
            <ul class="subNav">
                <li>sub_01</li>
                <li>sub_02</li>
                <li>sub_03</li>
                <li>sub_04</li>
            </ul>
        </li>
    </ul>

</body>
<script>

    $(".nav li").mouseenter(function () {
        // $(this).addClass("active").siblings().removeClass("active");
        // // li -> .subNav(显示)  -> li -> 同级li  ->  .subNav
        // $(this).find(".subNav").show().end().siblings().find(".subNav").hide();

        //  li -> .subNav(显示)  -> li -> 同级li  ->  .subNav
        $(this).addClass("active").find(".subNav").show().end().siblings().removeClass("active").find(".subNav").hide();
    })




</script>


</html>